home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form LabelMaker
- BorderStyle = 3 'Fixed Double
- Caption = "Address Book"
- ClientHeight = 6090
- ClientLeft = 2100
- ClientTop = 1680
- ClientWidth = 6540
- Height = 6780
- Icon = NEWNAME.FRX:0000
- Left = 2040
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 6090
- ScaleWidth = 6540
- Top = 1050
- Width = 6660
- Begin CommandButton QuitButton
- Caption = "QUIT"
- Height = 495
- Left = 4920
- TabIndex = 25
- Top = 4560
- Width = 1335
- End
- Begin ListBox NameList
- Height = 2175
- Left = 240
- Sorted = -1 'True
- TabIndex = 24
- Top = 3840
- Width = 4335
- End
- Begin TextBox HomePhone
- Height = 300
- Left = 4080
- TabIndex = 19
- Top = 3345
- Width = 1395
- End
- Begin TextBox FaxPhone
- Height = 285
- Left = 2160
- TabIndex = 17
- Top = 3345
- Width = 1395
- End
- Begin TextBox OfficePhone
- Height = 285
- Left = 240
- TabIndex = 15
- Top = 3360
- Width = 1395
- End
- Begin TextBox ZipCode
- Height = 285
- Left = 3390
- TabIndex = 13
- Top = 2565
- Width = 1215
- End
- Begin TextBox StateName
- Height = 285
- Left = 2715
- TabIndex = 11
- Top = 2550
- Width = 375
- End
- Begin TextBox CityName
- Height = 285
- Left = 255
- TabIndex = 9
- Top = 2565
- Width = 2160
- End
- Begin CommandButton Command1
- Caption = "Clear"
- Height = 375
- Left = 4920
- TabIndex = 26
- Top = 2160
- Width = 1335
- End
- Begin TextBox SuiteName
- Height = 300
- Left = 255
- TabIndex = 7
- Top = 1815
- Width = 3300
- End
- Begin CommandButton PrintLabel
- Caption = "Print Label"
- Height = 375
- Left = 4920
- TabIndex = 23
- Top = 1680
- Width = 1335
- End
- Begin CommandButton DeleteButton
- Caption = "Delete"
- Height = 375
- Left = 4920
- TabIndex = 22
- Top = 1200
- Width = 1335
- End
- Begin TextBox StreetName
- Height = 300
- Left = 255
- TabIndex = 4
- Top = 1080
- Width = 3285
- End
- Begin CommandButton SaveButton
- Caption = "Save"
- Height = 375
- Left = 4920
- TabIndex = 21
- Top = 720
- Width = 1335
- End
- Begin TextBox LastName
- Height = 330
- Left = 2520
- TabIndex = 3
- Top = 330
- Width = 2250
- End
- Begin TextBox FirstName
- Height = 330
- Left = 255
- TabIndex = 2
- Top = 330
- Width = 2145
- End
- Begin CommandButton AddButton
- Caption = "Add"
- Default = -1 'True
- Height = 405
- Left = 4920
- TabIndex = 20
- Top = 240
- Width = 1335
- End
- Begin Label Label8
- Caption = "Home Phone"
- Height = 210
- Left = 4080
- TabIndex = 18
- Top = 3105
- Width = 1215
- End
- Begin Label Label7
- Caption = "FAX"
- Height = 240
- Left = 2175
- TabIndex = 16
- Top = 3105
- Width = 375
- End
- Begin Label Label6
- Caption = "Office Phone"
- Height = 255
- Left = 255
- TabIndex = 14
- Top = 3090
- Width = 1215
- End
- Begin Label Label5
- Caption = "Zip Code"
- Height = 255
- Left = 3390
- TabIndex = 12
- Top = 2295
- Width = 855
- End
- Begin Label Label4
- Caption = "State"
- Height = 225
- Left = 2670
- TabIndex = 10
- Top = 2295
- Width = 495
- End
- Begin Label Label3
- Caption = "City"
- Height = 255
- Left = 270
- TabIndex = 8
- Top = 2295
- Width = 375
- End
- Begin Label Label2
- Caption = "Suite or P.O. Box"
- Height = 255
- Left = 240
- TabIndex = 6
- Top = 1545
- Width = 1575
- End
- Begin Label Label1
- Caption = "Street"
- Height = 255
- Left = 240
- TabIndex = 5
- Top = 825
- Width = 615
- End
- Begin Label LastLabel
- Caption = "Last Name"
- Height = 225
- Left = 2535
- TabIndex = 1
- Top = 90
- Width = 975
- End
- Begin Label FirstLabel
- Caption = "First Name"
- Height = 225
- Left = 240
- TabIndex = 0
- Top = 90
- Width = 975
- End
- Begin Menu About
- Caption = "About..."
- End
- Dim Groupvar As GroupRecord
- Sub About_Click ()
-
- Line1$ = " A VeeBee Address Book"
- Line2$ = Chr$(13) + Chr$(10) + "Copyright
- 1991 Knowledge Works, Inc."
- Line3$ = Chr$(13) + Chr$(10) + " Mark S. Burgess"
- MsgBox Line1$ + Line2$ + Line3$, 64, "About The Program"
- End Sub
- Sub AddButton_Click ()
- '--------Set the Group Values from Input
- Groupvar.Firstname = Firstname.Text
- Groupvar.LastName = LastName.Text
- Groupvar.StreetName = StreetName.Text
- Groupvar.SuiteName = SuiteName.Text
- Groupvar.CityName = CityName.Text
- Groupvar.StateName = UCase$(StateName.Text)
- Groupvar.ZipCode = ZipCode.Text
- Groupvar.OfficePhone = OfficePhone.Text
- Groupvar.FaxPhone = FaxPhone.Text
- Groupvar.HomePhone = HomePhone.Text
- '--------Calculate where to put it in the file
- LastRecord = LOF(100) \ Len(Groupvar)
- LastRecord = LastRecord + 1
- Groupvar.RecordNum = LastRecord
- '--------Add name to the file and to the list
- Put #100, LastRecord, Groupvar
- New$ = RTrim$(Groupvar.LastName) + ", " + Groupvar.Firstname
- NameList.AddItem New$, LastRecord - 1
- '--------Clear out the list
- Firstname.Text = ""
- LastName.Text = ""
- LastName.Text = ""
- StreetName.Text = ""
- SuiteName.Text = ""
- CityName.Text = ""
- StateName.Text = ""
- ZipCode.Text = ""
- OfficePhone.Text = ""
- FaxPhone.Text = ""
- HomePhone.Text = ""
- Firstname.SetFocus
- End Sub
- Sub CancelButton_Click ()
- Close
- End
- End Sub
- Sub CityName_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(CityName.Text)) = 20 Then
- KeyAscii = 0
- End If
- End Sub
- Sub Command1_Click ()
- Firstname.Text = ""
- LastName.Text = ""
- LastName.Text = ""
- StreetName.Text = ""
- SuiteName.Text = ""
- CityName.Text = ""
- StateName.Text = ""
- ZipCode.Text = ""
- OfficePhone.Text = ""
- FaxPhone.Text = ""
- HomePhone.Text = ""
- Firstname.SetFocus
- End Sub
- Sub DeleteButton_Click ()
- Dim Item As Integer
- Dim Steps As Integer
- If NameList.ListIndex = 0 Then ' Check if cursor in list box pos 1
- Item = 2 ' Set item to 2nd File Item
- Else ' otherwise
- Item = NameList.ListIndex + 2 ' set item 2 positions away in file
- End If
- LastRecord = LOF(100) \ Len(Groupvar) ' Get number of records in the file
- NameList.RemoveItem NameList.ListIndex ' Take out the list box display item
- For Steps = Item To LastRecord ' From start to end of file
- Get #100, Item, Groupvar ' retrieve next file record by item
- Put #100, Item - 1, Groupvar ' place it in deleted record pos
- Item = Item + 1 ' look to the next item in line
- Next Steps
- Open "~~NAMES.DAT" For Random As 200 Len = 184 ' Create a temporary holding file
- For Steps = 1 To (LastRecord - 1) ' From pos 1 to next to last record
- Get #100, Steps, Groupvar ' retrieve the record
- Put #200, Steps, Groupvar ' place it into the temp file
- Next Steps
- Close ' Close all files
- Kill "NAMES.DAT" ' Delete the original file
- Name "~~NAMES.DAT" As "NAMES.DAT" ' Rename the temp file
- Open "NAMES.DAT" For Random As 100 Len = 184 ' Open it for access
- NameList.SetFocus
- Firstname.SetFocus ' Replace the focus on first field
- End Sub
- Sub FaxPhone_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(FaxPhone.Text)) = 12 Then
- KeyAscii = 0
- End If
- End Sub
- Sub FileOpener_Click ()
- End Sub
- Sub FirstName_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(Firstname.Text)) = 20 Then
- KeyAscii = 0
- End If
- End Sub
- Sub FirstName_LostFocus ()
- If Len(RTrim$(Firstname.Text)) >= 20 Then
- Firstname.SetFocus
- End If
- End Sub
- Sub Form_Load ()
- Dim NewIndex As Integer
- NewIndex = 0
- msg$ = "To add someone to the List, type their name into"
- msg$ = msg$ + " the appropriate slots and click on the ADD"
- msg$ = msg$ + " button. You can retrieve the name by"
- msg$ = msg$ + " clicking on the name in the list."
- MsgBox msg$, 64, "To get you started..."
- Open "NAMES.DAT" For Random As 100 Len = 184
- Do Until EOF(100)
- Get #100, , Groupvar
- Names$ = RTrim$(Groupvar.LastName) + ", " + Groupvar.Firstname
- NameList.AddItem Names$, NewIndex
- NewIndex = NewIndex + 1
- Loop
- End Sub
- Sub GetPick ()
- Dim Item As Integer
- If NameList.ListIndex = 0 Then
- Item = 1
- Else
- Item = NameList.ListIndex + 1
- End If
- Get #100, Item, Groupvar
- Firstname.Text = Groupvar.Firstname
- LastName.Text = Groupvar.LastName
- StreetName.Text = Groupvar.StreetName
- SuiteName.Text = Groupvar.SuiteName
- CityName.Text = Groupvar.CityName
- StateName.Text = Groupvar.StateName
- ZipCode.Text = Groupvar.ZipCode
- OfficePhone.Text = Groupvar.OfficePhone
- FaxPhone.Text = Groupvar.FaxPhone
- HomePhone.Text = Groupvar.HomePhone
- End Sub
- Sub HomePhone_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(HomePhone.Text)) = 12 Then
- KeyAscii = 0
- End If
- End Sub
- Sub LastName_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(LastName.Text)) = 20 Then
- KeyAscii = 0
- End If
- End Sub
- Sub ListName_GotFocus ()
- Do Until EOF(1)
- Get #1, , Groupvar
- NameList.AddItem RTrim$(Groupvar.Firstname) + " " + Groupvar.LastName
- Loop
- End Sub
- Sub NameList_Click ()
- GetPick
- End Sub
- Sub NameList_DblClick ()
- GetPick
- End Sub
- Sub NameList_KeyDown (KeyCode As Integer, Shift As Integer)
- GetPick
- End Sub
- Sub NameList_KeyUp (KeyCode As Integer, Shift As Integer)
- GetPick
- End Sub
- Sub OfficePhone_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(OfficePhone.Text)) = 12 Then
- KeyAscii = 0
- End If
- End Sub
- Sub PrintLabel_Click ()
- If Len(RTrim$(Firstname.Text)) = 0 Then
- MsgBox "No Name Selected to Print", 16, "Printing Status"
- Exit Sub
- End If
- Names$ = RTrim$(Groupvar.Firstname) + " " + Groupvar.LastName
- PrintMsg = "Printing a label for " + Names$ + ", Please Wait..."
- Load PrintProcess
- If MsgBoxMsg = 2 Then
- Unload PrintProcess
- Exit Sub
- End If
- Printer.FontBold = -1
- Get #100, NameList.ListIndex + 1, Groupvar
- Open "\DEV\LPT1" For Output As #2
-
- Print #2, Names$
-
- Print #2, Groupvar.StreetName
- If Len(RTrim$(Groupvar.SuiteName)) > 0 Then
- Print #2, Groupvar.SuiteName
- ExtraLine$ = "Yes"
- End If
-
- City$ = RTrim$(Groupvar.CityName) + ", " + Groupvar.StateName + " " + Groupvar.ZipCode
- Print #2, City$
-
- If ExtraLine$ <> "Yes" Then
- Print #2, " "
- End If
-
- Do Until Count% = 2
- Count% = Count% + 1
- Print #2, " "
- Loop
- Count% = 0
- ExtraLine$ = " "
- Unload PrintProcess
- Close #2
- Firstname.SetFocus
- End Sub
- Sub QuitButton_Click ()
- Close
- End
- End Sub
- Sub SaveButton_Click ()
- '--------Set the Group Values from Input
- Groupvar.Firstname = Firstname.Text
- Groupvar.LastName = LastName.Text
- Groupvar.StreetName = StreetName.Text
- Groupvar.SuiteName = SuiteName.Text
- Groupvar.CityName = CityName.Text
- Groupvar.StateName = UCase$(StateName.Text)
- Groupvar.ZipCode = ZipCode.Text
- Groupvar.OfficePhone = OfficePhone.Text
- Groupvar.FaxPhone = FaxPhone.Text
- Groupvar.HomePhone = HomePhone.Text
- '--------Save the values back to the file
- Put #100, Groupvar.RecordNum, Groupvar
- NameList.RemoveItem NameList.ListIndex
- Names$ = RTrim$(Groupvar.LastName) + ", " + Groupvar.Firstname
- NameList.AddItem Names$, Groupvar.RecordNum - 1
- Firstname.SetFocus
- End Sub
- Sub StateName_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(StateName.Text)) = 2 Then
- KeyAscii = 0
- End If
- End Sub
- Sub StreetName_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(StreetName.Text)) = 30 Then
- KeyAscii = 0
- End If
- End Sub
- Sub SuiteName_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(SuiteName.Text)) = 30 Then
- KeyAscii = 0
- End If
- End Sub
- Sub ZipCode_KeyPress (KeyAscii As Integer)
- If Len(RTrim$(ZipCode.Text)) = 12 Then
- KeyAscii = 0
- End If
- End Sub
-